package com.code.family.entity.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;

import com.code.family.entity.enums.CategoryType;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

/**
 * 收支表实体类
 */
@TableName(value ="transactions")
@Data
public class Transactions implements Serializable {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private Integer accountId;
    // 0：收入/1：支出
    private Integer type;
    // 金额
    private Float amount;
    // 类别：住房、医疗、食品、交通、餐饮、穿搭、教育、娱乐、理发、理财
    private CategoryType category;
    // 支付方式
    private String payMethod;
    private LocalDate date;
    private String description;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createdAt;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date updatedAt;

    @TableField(exist = false)
    // 多表联查账户信息
    private Accounts accounts;

    @TableField(exist = false)
    @Serial
    private static final long serialVersionUID = 1L;
}